package cc.wsyw126.java.lambda;

import cc.wsyw126.java.model.User;

import java.util.ArrayList;
import java.util.List;
import java.util.StringJoiner;

/**
 * Created by junpeng.yang on 16/9/18.
 */
public class RefactorAndDefineCollext {
    public static void main(String[] args) {
        List<User> users = new ArrayList<>();
        for (int i = 0; i < 6; i++) {
            User user = new User();
            user.setName(""+i);
            user.setPassword(""+i);
            users.add(user);
        }


        String sb = users.stream().map(User::getName).reduce(new StringJoiner(",","[","]"),StringJoiner::add,StringJoiner::merge).toString();

        System.out.println("sb = " + sb);
    }
}
